Public Class form_DoanVien
    Private ojb As ObjUtils = New ObjUtils
    Private flagKeyCode As Boolean

    Private Sub form_DoanVien_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        autoKey(e)
    End Sub

    Private Sub form_DoanVien_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
        autoKey(e)
    End Sub

    ' key preview = true de gan phim tat cho form
    Private Sub form_DoanVien_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'QldvtnDataSet.tbl_doanvien' table. You can move, or remove it, as needed.
        Me.Tbl_doanvienTableAdapter.Fill(Me.QldvtnDataSet.tbl_doanvien)
        loadForm()
    End Sub
    Private Sub loadForm()
        ' xu ly ngam cac thuoc tinh cua doi tuong ultraGrid, 
        ' va khong kiem tra loi (none)khi load form
        ojb.addObject(New ObjUtils(Me.Tbl_doanvienUltraGrid, ObjUtils._None))
        ojb.disableAuToFitStyle(Me.Tbl_doanvienUltraGrid)
        ojb.setReadonly(False)

    End Sub
    Private Sub autoKey(ByVal e As System.Windows.Forms.KeyEventArgs)
        If e.KeyCode = e.Control And Keys.N Then
            taoMoi()
        End If
        If e.KeyCode = e.Control And Keys.S Then
            luu()
        End If
        If e.KeyCode = e.Control And Keys.D Then
            xoa()
        End If

        If e.KeyCode = e.Control And Keys.E Then
            sua()
        End If
        If e.KeyCode = e.Control And Keys.Home Then
            Me.movePosition("dau")
        End If
        If e.KeyCode = e.Control And Keys.End Then
            Me.movePosition("cuoi")
        End If
        If e.KeyCode = e.Control And Keys.Next Then
            Me.movePosition("toi")
        End If
        If e.KeyCode = e.Control And Keys.Back Then
            Me.movePosition("lui")
        End If
    End Sub
    Private Sub movePosition(ByVal viTri As String)
        If viTri = "dau" Then
            Me.Tbl_doanvienBindingSource.MoveFirst()
        End If
        If viTri = "cuoi" Then
            Me.Tbl_doanvienBindingSource.MoveLast()
        End If
        If viTri = "toi" Then
            Me.Tbl_doanvienBindingSource.MoveNext()
        End If
        If viTri = "lui" Then
            Me.Tbl_doanvienBindingSource.MovePrevious()
        End If
    End Sub

    Private Sub taoMoi()

    End Sub
    Private Sub luu()

    End Sub
    Private Sub xoa()

    End Sub
    Private Sub sua()

    End Sub
End Class